﻿///***************************************************************
/// 시  스  템 : Updms.Common.Inc
/// 단위시스템 : INC
/// 계      층 : Presentation Layer
/// 프로그램명 : HotLink
/// 파  일  명 : HotLink.aspx.cs
/// 설      명 : 메뉴핫링크
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-28 송시명   최초 작성
///***************************************************************
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

using SMFramework.Configuration;
using SMFramework.Data;

using Updms.Com.Exe;
using Updms.Usr.Exe;


namespace Updms.Common.Inc
{
	public partial class HotLink : System.Web.UI.Page
	{
		#region Page_Load

		protected void Page_Load(object sender, EventArgs e)
		{
			SetClientScript();
			if (Session["User_Id"] == null)
			{
				//세션이 종료되었습니다. 창을 닫습니다
				ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), null, "alert(getMsg(MSG_ERR_114));window.close();", true);
			}
			else
			{
				DataPack lo_dp = new DataPack();

				lo_dp.AddProperty("ls_user_id", typeof(string), Session["User_Id"].ToString().Trim());
				lo_dp.AddProperty("ls_lang_set", typeof(string), Session["Lang_Set"].ToString().Trim());

				SetHotLinkList(lo_dp);
				SetFavoriteList(lo_dp);
			}
		}

		#endregion

		#region SetClientScript

		//SetClientScript
		private void SetClientScript()
		{
			ddl_hotlink.Attributes.Add("onchange", "moveParentObj(this)");
			ddl_favorite.Attributes.Add("onchange", "moveParentObj(this)");
		}

		#endregion

		#region SetHotLinkList, SetFavoriteList

		//핫링크
		private void SetHotLinkList(DataPack lo_dp)
		{
			DataSet lo_ds = new DataSet();
			
			using (Com1014m_NT _Com1014m_NT = new Com1014m_NT())
			{
				lo_ds.Merge(_Com1014m_NT.GetHotLinkList(lo_dp));
			}

			ddl_hotlink.Items.Clear();
			ddl_hotlink.DataSource = lo_ds;
			ddl_hotlink.DataMember = "UPDMS_COM_MENU_HOTLINK";
			ddl_hotlink.DataTextField = "Text";
			ddl_hotlink.DataValueField = "Value";
			ddl_hotlink.DataBind();
			ddl_hotlink.Items.Insert(0, new ListItem("------------ HOT LINK ------------", "javascript:void(0);"));
		}

		//즐겨찾기
		private void SetFavoriteList(DataPack lo_dp)
		{
			DataSet lo_ds = new DataSet();
			
			using (Usr1011m_NT _Usr1011m_NT = new Usr1011m_NT())
			{
				lo_ds.Merge(_Usr1011m_NT.GetFavoriteList(lo_dp));
			}

			ddl_favorite.Items.Clear();
			ddl_favorite.DataSource = lo_ds;
			ddl_favorite.DataMember = "UPDMS_USR_FAVORITE_SEARCH";
			ddl_favorite.DataTextField = "Text";
			ddl_favorite.DataValueField = "Value";
			ddl_favorite.DataBind();
			ddl_favorite.Items.Insert(0, new ListItem("------------ FAVORITE ------------", "javascript:void(0);"));
		}

		#endregion

		#region SetTimeStamp

		//SetTimeStamp
		public String SetTimeStamp()
		{
			return WebConfig.Updms["App.TimeStamp"];
		}

		#endregion
	}
}
